package org.example.Lambda;

import java.util.function.Function;

/** @ClassName: LambdaDemo04 @Author NeySun @Description: TODO @Version 1.0 @Date 2022-03-03 */
public class LambdaDemo04 {

  public static void main(String[] args) {
    // 关注参数列表返回值\返回值类型
    //        typeConver((s)->{
    //            return Integer.valueOf(s);
    //        });
    //  1.

    String s1 = typeConver((s) -> s + "三更");
    System.out.println(s1);

    // 2.
    Integer result =
        typeConver(
            new Function<String, Integer>() {
              @Override
              public Integer apply(String s) {
                return Integer.valueOf(s);
              }
            });
    System.out.println(result);
  }

  public static <R> R typeConver(Function<String, R> function) {
    String str = "1235";
    R result = function.apply(str);
    return result;
  }
}
